import qs from 'qs'
import axios from "axios"
 
// export const ApiUrl = "http://192.168.216.1:9527";
export const ApiUrl = "http://125.70.231.243:49527";

const ajax = (opt) => {
    opt = opt || {};
    opt.url = opt.url || '';
    opt.data = opt.data || null;
    opt.method = opt.method || 'GET';
    opt.header = opt.header || {
        'Content-Type': 'application/json;charset=UTF-8',
                'Accept': 'application/json;charset=UTF-8',
                'jzg_token':uni.getStorageSync('jzg_token')
                
    };
    opt.success = opt.success || function () {};

    uni.request({
        url: ApiUrl + opt.url,
        data: opt.data,
        method: opt.method,
        header: opt.header,
        dataType: 'json',
        success: function (res) {
            opt.success(res);
        },
        fail: function () {
            uni.showToast({
                title: '请稍后重试',
				icon:"none"
            });
        }
    })
}

export {
    ajax
}


